#!/usr/bin/perl # for syntax highlighting
# CSS-V1

sub mm_portal_report_list_headers($$) {
my ($order_by,$portal)=@_;

	my $d;
	if(exists($::ENV{PATH_INFO}) && length($::ENV{PATH_INFO})>1) {
		$d="../images";
	} else {
		$d="images";
	}

	if($order_by eq "?order_by - not defined?") {
		$order_by="name";
	}
	#################################################################
	# If the value specified is not recognised then default to name	#
	#################################################################
	my @S=qw(name rname type rtype report rreport treports rtreports);
	if(! grep {$_ eq $order_by} @S) {
		$order_by="name";
	}
	my $s="";
	my $s1="<td width=50% class=gri_cell>";
	$s=$s1;

	if($order_by eq "name") {
		my $l=link_to_str("headinglink","Report","portal_tl","portal=$portal,order_by=rname");
		$s.=$l . "&nbsp;&nbsp;<img src=\"$d/down_16.png\"></td>";
	} else {
		my $l=link_to_str("headinglink","Report","portal_tl","portal=$portal,order_by=name");
		$s.=$l;
		if($order_by eq "rname") {
			$s.="&nbsp;&nbsp;<img src=\"$d/up_16.png\">";
		}
		$s.="</td>";
	}

	$s1="<td class=gri_cell-center width=10%>";
	$s.=$s1;
	if($order_by eq "type") {
		my $l=link_to_str("headinglink","Type","portal_tl","portal=$portal,order_by=rtype");
		$s.=$l . "&nbsp;&nbsp;<img src=\"$d/down_16.png\"></td>";
	} else {
		my $l=link_to_str("headinglink","Type","portal_tl","portal=$portal,order_by=type");
		$s.=$l . "&nbsp;&nbsp;";
		if($order_by eq "rtype") {
			$s.="<img src=\"$d/up_16.png\">";
		}
		$s.="</td>";
	}

	$s1="<td class=gri_cell-center width=15%>";
	$s.=$s1;
	if($order_by eq "report") {
		my $l=link_to_str("headinglink","Latest Report","portal_tl","portal=$portal,order_by=rreport");
		$s.=$l . "&nbsp;&nbsp;<img src=\"$d/down_16.png\"</td>";
	} else {
		my $l=link_to_str("headinglink","Latest Report","portal_tl","portal=$portal,order_by=report");
		$s.=$l . "&nbsp;&nbsp;";
		if($order_by eq "rreport") {
			$s.="<img src=\"$d/up_16.png\">";
		}
		$s.="</td>";
	}

	$s1="<td class=gri_cell-center width=15%>";
	$s.=$s1;
	if($order_by eq "treports") {
		my $l=link_to_str("headinglink","Total Reports","portal_tl","portal=$portal,order_by=rtreports");
		$s.=$l . "&nbsp;&nbsp;<img src=\"$d/down_16.png\"</td>";
	} else {
		my $l=link_to_str("headinglink","Total Reports","portal_tl","portal=$portal,order_by=treports");
		$s.=$l . "&nbsp;&nbsp;";
		if($order_by eq "rtreports") {
			$s.="<img src=\"$d/up_16.png\">";
		}
		$s.="</td>";
	}

	$s1="<td class=gri_cell-right width=15%>Actions</td>\n";
	$s.=$s1;

	return $s;
}
